<?php
get_header();
require(WEBTREATS_INCLUDES . "/var.php");

if ($custom_use_more_quicktag) { global $more; }

$exclude_blog_cats = preg_replace("!(\d)+!","-${0}$0", $blog_excludecats);
query_posts($query_string . '&cat='.$exclude_blog_cats);
?>

<?php if(have_posts()) : ?>

<div id="body_block" <?php webtreats_body_class(); ?>>
	
<?php if($home_slider_page) { webtreats_header_slider_switcher($homepage_slider); } ?>
	
<?php if($header_teaser != 'disable') : ?>
	<div id="intro_blurb">
		<div class="inner">
			<h1>Archives</h1>
				<div id="blurb">
				<?php if (!$header_disable) { ?>
					<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
					<?php /* If this is a category archive */ if (is_category()) { ?>
					Category Archive for: &lsquo;<?php single_cat_title(); ?>&rsquo;
					<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
					All Posts Tagged Tag: &lsquo;<?php single_tag_title(); ?>&rsquo;
					<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
					Daily Archive for: &lsquo;<?php the_time('F jS, Y'); ?>&rsquo;
					<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
					Monthly Archive for: &lsquo;<?php the_time('F, Y'); ?>&rsquo;
					<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
					Yearly Archive for: &lsquo;<?php the_time('Y'); ?>&rsquo;
					<?php /* If this is an author archive */ } elseif (is_author()) { 
					$curauth = get_userdata(intval($author)); ?>
					Author Archive for: &lsquo;<?php echo $curauth->nickname; ?>&rsquo;
					<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
					Blog Archives
					<?php } ?>
				<?php } ?>				
			</div>
		</div>
	</div><!-- intro_blurb -->
	<div class="clearboth"></div>
<?php endif; ?>

<div id="body_block_background">
<div class="inner">

<?php if (!$breadcrumb_disable){ if (class_exists('simple_breadcrumb')) { $bc = new simple_breadcrumb; }} ?>

	<div id="main">
		<div class="content">
		
<?php if($header_teaser == 'disable') : ?>
	<h1>
		<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
		<?php /* If this is a category archive */ if (is_category()) { ?>
		Category Archive for: &lsquo;<?php single_cat_title(); ?>&rsquo;
		<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
		All Posts Tagged Tag: &lsquo;<?php single_tag_title(); ?>&rsquo;
		<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
		Daily Archive for: &lsquo;<?php the_time('F jS, Y'); ?>&rsquo;
		<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
		Monthly Archive for: &lsquo;<?php the_time('F, Y'); ?>&rsquo;
		<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
		Yearly Archive for: &lsquo;<?php the_time('Y'); ?>&rsquo;
		<?php /* If this is an author archive */ } elseif (is_author()) { 
		$curauth = get_userdata(intval($author)); ?>
		Author Archive for: &lsquo;<?php echo $curauth->nickname; ?>&rsquo;
		<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
		Blog Archives
		<?php } ?>
	</h1>
<?php endif; ?>

<?php while(have_posts()) : the_post(); ?>

	<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
		<div class="blog_module">

			<?php webtreats_post_image(); ?>

			<h2 class="blog_header">
				<a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a>
				<span class="comment_bubble"><?php comments_popup_link('0', '1', '%'); ?></span>
			</h2>		

			<div class="entry">
				<?php
				if ($custom_use_more_quicktag) {
					$more = 0;
					the_content("Read More",false);
				}else{ 
					the_excerpt(); ?><a class="fancy_link read_more_link" href="<?php the_permalink(); ?>">Read More</a>
				<?php } ?>
			</div>

			<div class="blog_meta">
				<?php $get_year = get_the_time('Y'); $get_month = get_the_time('m'); ?>
				Posted on: <a href="<?php echo get_month_link($get_year, $get_month); ?>"><?php the_time('m-j-Y') ?></a><br />
				Posted in: <?php the_category(', ') ?>
			</div>

		</div><!-- blog_module -->
	</div><!-- post -->
	
	
<?php endwhile; endif; ?>

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>